#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.contrib import admin
from markitup.widgets import AdminMarkItUpWidget
from snippets.models import Snippet

class SnippetAdmin(admin.ModelAdmin):
    list_display = ['__unicode__', 'slug', 'filter', 'publish']
    exclude = ['content_ru']

    def formfield_for_dbfield(self, db_field, **kwargs):
        if db_field.name in ('content', 'content_ru','content_en'):
            kwargs['widget'] = AdminMarkItUpWidget()
        return super(SnippetAdmin, self).formfield_for_dbfield(db_field, **kwargs)

admin.site.register(Snippet, SnippetAdmin)